<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="./js/Itcast.core.js"></script>
    <script src="./js/itcast.ctor.js"></script>
    <script src="./js/Itcast.dom.js"></script>
    <script src="./js/Itcast.event.js"></script>
    <script SRC="./js/Itcast.style.js"></script>
    <script>
        Itcast.fn.extend({
            attr: function( name , value ){
                if ( value === undefined ) {
                    return this[0].getAttribute(name);
                }else {
                    return this.each(function(){
                        this.setAttribute(name,value);
                    });
                }
            },
            prop: function( name , value){
                if ( value === undefined ) {
                    return this[0][ name ];
                }else {
                    return this.each(function(){
                        this[name] = value;
                    });
                }
            }
        });

        Itcast.each({
            html: 'innerHTML',
            text: 'innerText',
            val: 'value'
        },function( k , v ){
            Itcast.fn[ k ] = function( value ){
                if ( value === undefined ) {
                    return this[0][v];
                }else {
                    return this.each(function(){
                        this[ v ] = value;
                    })
                }
            }
        });


    </script>
</head>
<body>
    
</body>
<script>


    I( '<img src="" />' )
    .appendTo( 'body' )
    .attr( 'src', 'https://ss1.baidu.com/9vo3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=8c56d4a6d8c8a786a12a4c0e5708c9c7/5bafa40f4bfbfbed022d422371f0f736afc31f71.jpg' );
    I('<div></div>').css({
        width: '200px',
        height: '100px',
        border: '1px dashed red'
    }).html('<span>我是 span 标签</span>').text('<p>我是文本</p>')
            .val('我是value').appendTo('body');

    // alert( I( 'img' ).attr( 'src' ) );
</script>
</html>